// debug模式，允许用{:?}来输出
#[derive(Debug)]
// 方向枚举
enum Direction {
    N,
    S,
    W,
    E,
}

// 玩家动作枚举
enum PlayerAction {
    Move {
        direction: Direction,
        speed: u8,
    },
    Wait,
    Attack(Direction),
}

fn main() {
    // simulated 模仿
    let simulated_player_action = PlayerAction::Move {
        // 变体与枚举名用双冒号引用
        direction: Direction::N,
        speed: 2,
    };

    match simulated_player_action {
        PlayerAction::Wait => println!("Player wants wait"),
        PlayerAction::Move { direction, speed } => {
            println!("Player wants to move in direction: {:?} with speed: {:?}", direction, speed);
        }
        PlayerAction::Attack(direction) => {
            println!("Player wants to attack direction: {:?}", direction);
        }
    }
}

